<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

Route::group(['middleware' => ['web']], function () {

    Route::get('menu',['as' => 'Home.Page.menu', 'uses' => 'HomeController@menu']);
    Route::get('content',['as' => 'Home.Page.content', 'uses' => 'HomeController@content']);

    Route::group(['prefix'=>'admin'],function(){
        Route::get('login',['as' => 'Admin.Home.login', 'uses' => 'AdminController@login']);
    });

    Route::group(['prefix'=>'api', 'namespace'=>'Api'],function(){

        Route::group(['prefix' => 'wx'],function(){
            Route::any('index',['as'=>'Api.Wechat.index','uses'=>'WechatController@index']);
        });

        Route::group(['prefix' => 'admin','namespace'=>'Admin'],function(){
            Route::post('auth/sign-in',['as'=>'Api.Admin.Auth.signInAdmin','uses'=>'AuthController@signInAdmin']);
            Route::post('auth/change-pwd',['as'=>'Api.Admin.Auth.changePassword','uses'=>'AuthController@changePassword']);
            Route::post('daka/setDakaContent',['as'=>'Api.Admin.daka.setDakaContent','uses'=>'DakaController@setDakaContent']);
            Route::post('daka/delDaka',['as'=>'Api.Admin.daka.delDaka','uses'=>'DakaController@delDaka']);
            Route::post('sys/setBanner',['as'=>'Api.Admin.sys.setBanner','uses'=>'SystemController@setBanner']);
            Route::post('sys/delBanner',['as'=>'Api.Admin.sys.delBanner','uses'=>'SystemController@delBanner']);
            Route::get('auth/signOut',['as'=>'Api.Admin.Auth.signOut','uses'=>'AuthController@signOut']);
        });

        Route::group(['prefix' => 'file'],function(){
            Route::post('upload-img',['as'=>'Api.File.upload','uses'=>'ImageController@upload']);
            Route::get('show-image/{id}',['as'=>'Api.File.showImageById','uses'=>'ImageController@showImageById']);
            Route::post('upload-user-photo',['as'=>'Api.File.uploadUserPhoto','uses'=>'ImageController@uploadUserPhoto']);
        });

        Route::group(['prefix' => 'auth'],function(){
            Route::any('wxLogin',['as'=>'Api.Auth.wxLogin','uses'=>'AuthController@wxLogin']);
        });
    });
});
